﻿//
// <author>David Nohejl</author>
//
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace WPFTrees.Parser
{
    /// <summary>
    /// Token.
    /// </summary>
    class Token : IEquatable<Token>
    {
        string value;
        TokenType type;
        public Token(string s, TokenType type)
        {
            value = s;
            this.type = type;
        }

        public string Value { get { return value; } }

        public TokenType Type { get { return type; } }

        public override string ToString()
        {
            return value;
        }

        public override bool Equals(object obj)
        {
            Token other = obj as Token;
            if (other == null)
                return false;
            return Equals(other);
        }
        public bool Equals(Token other)
        {
            return (this.value == other.value)
                && (this.type == other.type);
        }
    }
}
